<template>
  <div class="common-table">
    <el-table :data="tableData" height="90%" stripe>
      <el-table-column
      v-for="(item,index) in tableLabel"
      :key="index"
      :prop="item.porp"
      :label="item.label"
      :width="item.width ? item.width : 120">
      </el-table-column>
      <el-table-column label="操作" min-width="160">
        <el-button size="mini" @click="handleEdit">编辑</el-button>
        <el-button size="mini" type="danger" @click="handleDelete"
          >删除</el-button
        >
      </el-table-column>
    </el-table>
     <div class="block">
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="changePage"
      :current-page.sync="page"
      :page-size="20"
      layout="prev, pager, next, jumper"
      :total="config.total">
    </el-pagination>
      </div>
  </div>
</template>
<script>
export default {
  name: "CommonTable",
  props: {
    tableData:Array,
    tableLabel: Array,
    config:Object
  },
  created(){
  },
  data() {
    return {
      page:this.config.page
    }
  },
  methods: {
    handleEdit(row) {
      this.$emit("edit", row);
    },
    handleDelete(row) {
      this.$emit("del", row);
    },
    changePage(page) {
      this.$emit("changePage", page);
    },
    handleSizeChange(){
    }
  },
};
</script>
<style lang="less" scoped>
.common-table {
  height: calc(100% - 62px);
  background-color: #fff;
  position: relative;
  .pager {
    position: absolute;
    bottom: 0;
    left: 20px;
  }
}
</style>
